﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Silverlight="clr-namespace:Corina.Controls.Silverlight;assembly=Corina.Controls.Silverlight"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                    mc:Ignorable="d">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Brushes.xaml" />
        <ResourceDictionary Source="../Converters.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="TopmenuItemStyle" TargetType="ListBoxItem">
        <Setter Property="FontSize" Value="18" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Height="39" MinWidth="80">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="SelectedUnfocused">
                                    <Storyboard>
                                        <ColorAnimation Duration="0"
                                                        Storyboard.TargetName="textBlock"
                                                        Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"
                                                        To="Black"
                                                        d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ColorAnimation Duration="0"
                                                        Storyboard.TargetName="textBlock"
                                                        Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"
                                                        To="Black"
                                                        d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border CornerRadius="{Binding SelectedIndex, ConverterParameter=5-0-0-0, Converter={StaticResource SelectedIndexToCornerRadiusConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBox}}" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}">
                            <Border.Background>
                                <ImageBrush ImageSource="/Corina.Lantern.Hub;component/Images/Navi_Selected_1.png" Stretch="Fill" />
                            </Border.Background>
                        </Border>

                        <TextBlock x:Name="textBlock"
                                   Margin="12,0"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   FontSize="{TemplateBinding FontSize}"
                                   FontWeight="Light"
                                   Foreground="White"
                                   Style="{StaticResource Heading5}"
                                   Text="{Binding Title}" />

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SubmenuItemStyle" TargetType="ListBoxItem">
        <Setter Property="FontSize" Value="14" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Height="24" Margin="3">
                        <Border Background="{StaticResource COLOR_GRAY}"
                                CornerRadius="12"
                                Visibility="{Binding IsSelected,
                                                     Converter={StaticResource BooleanToVisibilityConverter},
                                                     RelativeSource={RelativeSource TemplatedParent}}">
                            <Border.Effect>
                                <DropShadowEffect BlurRadius="1"
                                                  Direction="-90"
                                                  Opacity="0.5"
                                                  ShadowDepth="1"
                                                  Color="{StaticResource ColorForegroundShadowColor}" />
                            </Border.Effect>
                        </Border>

                        <TextBlock Margin="12,0"
                                   VerticalAlignment="Center"
                                   FontSize="{TemplateBinding FontSize}"
                                   FontWeight="Light"
                                   Style="{StaticResource Heading6}"
                                   Text="{Binding Title}" />

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TopmenuListboxStyle" TargetType="ListBox">
        <Setter Property="Margin" Value="0,-1" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource TopmenuItemStyle}" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SubmenuListboxStyle" TargetType="ListBox">
        <Setter Property="Margin" Value="0,-1" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource SubmenuItemStyle}" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <toolkit:WrapPanel />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
